//
//  SongListCollectionViewCell.m
//  YHYRealx
//
//  Created by yanghuiyan on 16/5/3.
//  Copyright © 2016年 yanghuiyan. All rights reserved.
//

#import "SongListCollectionViewCell.h"

@implementation SongListCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.songListImagView = [[UIImageView alloc] initWithFrame:CGRectZero];
        self.songListImagView.userInteractionEnabled = YES;
        self.songListListenCountLable = [[YHYBaseLabel alloc] initWithFrame:CGRectZero];
        _songListListenCountLable.textColor = [UIColor colorWithRed:0.57 green:0.59 blue:0.62 alpha:1.00];
        _songListListenCountLable.font = [UIFont systemFontOfSize:16];
        self.songListTitleLable = [[YHYBaseLabel alloc] initWithFrame:CGRectZero];
        _songListTitleLable.textColor = [UIColor colorWithRed:0.57 green:0.59 blue:0.62 alpha:1.00];
        _songListTitleLable.font = [UIFont systemFontOfSize:15];
        self.erJiButton = [UIButton buttonWithType:UIButtonTypeSystem];
        
        [self.erJiButton setImage:[[UIImage imageNamed:@"音乐听"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
        
        [self.contentView addSubview:self.songListImagView];
//        [self.songListImagView addSubview:self.songListListenCountLable];
        [self.contentView addSubview:self.songListTitleLable];
//        [self.songListImagView addSubview:self.erJiButton];
    }
    return self;
}
- (void)layoutSubviews {
    
    self.songListImagView.frame = CGRectMake(10, 10, self.bounds.size.width - 20, self.bounds.size.width - 60);
    self.songListTitleLable.frame = CGRectMake(10, self.songListImagView.frame.size.height + 10, self.bounds.size.width - 40, 21);
//    self.songListListenCountLable.frame = CGRectMake(self.songListImagView.bounds.size.width *0.8, 30, 30, 21);
////    self.songListListenCountLable.font = [UIFont systemFontOfSize:10];
//    self.erJiButton.frame = CGRectMake(self.songListImagView.bounds.size.width *0.7, 10, 25, 25);
    
}
- (void)setSingListButtonModel:(SongListModel *)singListButtonModel {
    _singListButtonModel = singListButtonModel;
    
    [self.songListImagView sd_setImageWithURL:[NSURL URLWithString:singListButtonModel.pic_url]placeholderImage:[UIImage imageNamed:@"音乐听"]];
    
//    self.songListListenCountLable.text = [NSString stringWithFormat:@"%.1f万", singListButtonModel.listen_count.floatValue / 10000];
    self.songListTitleLable.text = singListButtonModel.title;
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
